package com.wh.wisdomsite.xbox.common;

import com.wh.wisdomsite.xbox.common.annotation.HttpAction;


/***
 * 服务方法定义
 * @Package com.wh.wisdomsite.xbox.common
 * @author 谢泽鹏
 * @date 2016年11月07日 下午15:10
 * @Copyright 个人版权所有
 * @Company 贵州万华科技有限公司Copyright (c) 2016
 * @version V1.0
 */
public class ServiceMethodDefinition {

    /**
     * 默认的组
     */
    public static final String DEFAULT_GROUP = "DEFAULT";

    /**
     * 默认分组标识
     */
    public static final String DEFAULT_GROUP_TITLE = "DEFAULT GROUP";

    /**
     * 方法名
     */
    private String method;

    /**
     * 方法描述
     */
    private String title;

    /**
     * 版本
     */
    private String version;

    /**
     * 最大超时时间
     */
    private int timeout;

    /**
     * 方法所在组
     */
    private String group = DEFAULT_GROUP;

    /**
     * 组描述
     */
    private String gropupTitle = DEFAULT_GROUP_TITLE;

    private String[] tags = {};

    /**
     * 接受的http方法
     */
    private HttpAction[] httpActions;

    /**
     * 是否需要进行会话校验
     */
    private boolean needInSession;

    /**
     * 是否忽略服务请求签名的校验，默认为false
     */
    private boolean ignoreSign;

    /**
     * 服务方法是否已经过期
     */
    private boolean obsoleted;

    private Class handlerClass;

    public int getTimeout() {
        return timeout;
    }

    public void setTimeout(int timeout) {
        this.timeout = timeout;
    }

    public String getGroup() {
        return group;
    }

    public void setGroup(String group) {
        this.group = group;
    }

    public String getGropupTitle() {
        return gropupTitle;
    }

    public void setGropupTitle(String gropupTitle) {
        this.gropupTitle = gropupTitle;
    }

    public String[] getTags() {
        return tags;
    }

    public void setTags(String[] tags) {
        this.tags = tags;
    }

    public boolean isNeedInSession() {
        return needInSession;
    }

    public void setNeedInSession(boolean needInSession) {
        this.needInSession = needInSession;
    }

    public boolean isIgnoreSign() {
        return ignoreSign;
    }

    public void setIgnoreSign(boolean ignoreSign) {
        this.ignoreSign = ignoreSign;
    }

    public boolean isObsoleted() {
        return obsoleted;
    }

    public void setObsoleted(boolean obsoleted) {
        this.obsoleted = obsoleted;
    }

    public Class getHandlerClass() {
        return handlerClass;
    }

    public void setHandlerClass(Class handlerClass) {
        this.handlerClass = handlerClass;
    }

    public static String methodWithVerion(String method, String version) {
        return method + "$" + version;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public HttpAction[] getHttpActions() {
        return httpActions;
    }

    public void setHttpActions(HttpAction[] httpActions) {
        this.httpActions = httpActions;
    }
}
